package com.ibangnuo.manage.controller.withdrawal;

import com.ibangnuo.api.withdrawal.WithdrawalControllerApi;
import com.ibangnuo.framework.domain.Withdrawal;
import com.ibangnuo.framework.domain.request.withdrawal.WithdrawalRequest;
import com.ibangnuo.framework.model.response.ObjectResult;
import com.ibangnuo.framework.model.response.QueryResponseResult;
import com.ibangnuo.framework.model.response.ResponseResult;
import com.ibangnuo.manage.service.withdrawal.WithdrawalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: wwy
 * @Date: 2020-03-12 12:06
 * 提现记录
 */
@RestController
@RequestMapping("/withdrawal")
public class WithdrawalController implements WithdrawalControllerApi {
    @Autowired
    private WithdrawalService withdrawalService;
    /**
     * 分页条件查询
     * @param page
     * @param size
     * @param withdrawalRequest
     * @return
     */
    @PostMapping("/list/{page}/{size}")
    @Override
    public QueryResponseResult findList(@PathVariable("page") int page, @PathVariable("size") int size, @RequestBody WithdrawalRequest withdrawalRequest) {
        return null;
    }

    /**
     * 添加
     * @param withdrawal
     * @return
     */
    @PostMapping("/add")
    @Override
    public ResponseResult add(@RequestBody Withdrawal withdrawal) {
        return withdrawalService.add(withdrawal);
    }

    /**
     * 根据月汇总查询id查询
     * @param orderTotalMonthId
     * @return
     */
    @GetMapping("/findByOrderTotalMonthId/{orderTotalMonthId}")
    @Override
    public ObjectResult findByOrderTotalMonthId(@PathVariable("orderTotalMonthId") String orderTotalMonthId) {
        return withdrawalService.findByOrderTotalMonthId(orderTotalMonthId);
    }

    /**
     * 佣金提现修改
     * @param id
     * @return
     */
    @PostMapping("/update/{id}")
    @Override
    public ResponseResult update(@PathVariable("id") String id,@RequestBody Withdrawal withdrawal) {
        return withdrawalService.update(id,withdrawal);
    }
}
